All Event Handlers
EVENT HANDLER: onMouseDown
onMouseDown
= myJavaScriptCode
Event handler for
Button
,
Document
and
Link
The
onMouseDown
event handler is used to execute specified Javascript code whenever the user depresses a mouse button.
onMouseDown
uses the following properties of the
Event
object:
type
- indicates the type of event.
target
- indicates the target object to which the event was sent.
layerX, layerY, pageX, pageY, screenX, screenY
indicate the cursor location at the time of the MouseDown event.
which
- 1 represents a left mouse click and 3 a right click.
modifiers
- lists the modifier keys (shift, alt, ctrl, etc.) held down when the MouseDown event occurs.
For example, with the following code, the user can click on the word 'green' to alter the background color to green. Depressing the mouse button calls the 'changeColor' function to do this:
Code:
<P>Click on <B><A onMouseDown="changeColor()"> green</A></B> to change background color.</P>
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information